package com.example.springbootdemo.listener;

import com.example.springbootdemo.event.UserRegisteredEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

@Component("UserRegisteredListener")
public class UserRegisteredListener {
  private static final Logger log = LoggerFactory.getLogger(UserRegisteredListener.class);

  @EventListener
  public void userRegistered(UserRegisteredEvent event) {
    System.out.println(event);
    System.out.println(log);
    log.debug("event: {}", event);
//    log.info("event: {}", event);
//    log.error("event: {}", event);
//    log.warn("event: {}", event);
//    log.trace("event: {}", event);
  }
}
